سه شنبه 10 شهریور 1405

بازديد استاندار آذربايجان غربي از شهرك صنعتي شماره3 اروميه

بازديد استاندار آذربايجان غربي از شهرك صنعتي شماره3 اروميه

بازديد استاندار آذربايجان غربي از شهرك صنعتي شماره3 اروميه

کلمات کلیدی

نظرات

0 نظر برای این مطلب وجود دارد

نظر دهید

${printHTML} `); win.document.close(); setTimeout(function(){ win.focus(); win.print(); win.close(); },500); } ${clone.outerHTML} `); doc.close(); iframe.onload = function () { setTimeout(function () { iframe.contentWindow.focus(); iframe.contentWindow.print(); setTimeout(function () { iframe.remove(); }, 1000); }, 300); }; }; } if (pdfBtn) { pdfBtn.onclick = function (e) { e.preventDefault(); if (!printArea) { alert('محتوا پیدا نشد'); return; } var clone = getCleanClone(); var wrapper = document.createElement('div'); wrapper.style.cssText = ` position: fixed; top: 0; left: -9999px; width: 800px; background: #ffffff; padding: 30px; direction: rtl; text-align: right; font-family: Tahoma, Arial, sans-serif; line-height: 2; color: #222; z-index: -1; `; wrapper.appendChild(clone); document.body.appendChild(wrapper); var imgs = wrapper.querySelectorAll('img'); var loaded = 0; var total = imgs.length; function generatePdf() { html2canvas(wrapper, { scale: 2, useCORS: true, backgroundColor: '#ffffff', windowWidth: 800 }).then(function (canvas) { document.body.removeChild(wrapper); var imgData = canvas.toDataURL('image/jpeg', 0.95); var jsPDF = window.jspdf.jsPDF; var pdf = new jsPDF({ orientation: 'portrait', unit: 'mm', format: 'a4' }); var pageWidth = pdf.internal.pageSize.getWidth(); var pageHeight = pdf.internal.pageSize.getHeight(); var imgWidth = pageWidth - 20; var imgHeight = canvas.height * imgWidth / canvas.width; var heightLeft = imgHeight; var position = 10; pdf.addImage(imgData, 'JPEG', 10, position, imgWidth, imgHeight); heightLeft -= pageHeight; while (heightLeft > 0) { position = heightLeft - imgHeight; pdf.addPage(); pdf.addImage(imgData, 'JPEG', 10, position, imgWidth, imgHeight); heightLeft -= pageHeight; } pdf.save('article.pdf'); }); } if (total === 0) { generatePdf(); } else { imgs.forEach(function (img) { if (img.complete) { loaded++; if (loaded === total) generatePdf(); } else { img.onload = img.onerror = function () { loaded++; if (loaded === total) generatePdf(); }; } }); } }; } });
تنظیمات قالب